package com.mcy.springbatch.writer;

import com.mcy.springbatch.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 利用ItemWriter简单输出数据
 * @author : Create By mcy
 * @date : 2019/8/25 22:40:49
 */
@Slf4j
@Component
public class SysUserItemWriter implements ItemWriter<SysUser> {
    @Override
    public void write(List<? extends SysUser> items) throws Exception {
        items.forEach(user->{
            log.info("遍历写出数据，线程ID：{}，数据：{}",Thread.currentThread().getId(),user.toString());
        });
    }
}
